<!--添加修改角色信息-->
<template>
  <a-modal v-model="showAddTable" :mask-closable="false" :closable="false" :width="600"
           title="个人成绩"
           :maskClosable="false"
           :destroyOnClose="true">
    <a-form :form="form" class="modelSearch">
      <a-form-item label="课程名称：" v-bind="formStyle">
        <span>{{ personScore.courseName }}</span>
      </a-form-item>
      <a-form-item label="所在实验室：" v-bind="formStyle">
        <span>{{ personScore.classroomName }}</span>
      </a-form-item>
      <a-form-item label="实验桌号：" v-bind="formStyle">
        <span>{{ personScore.diskNum }}</span>
      </a-form-item>
      <a-form-item label="授课教师：" v-bind="formStyle">
        <span>{{ personScore.teacherName }}</span>
      </a-form-item>
      <a-form-item label="总分：" v-bind="formStyle">
        <span>{{ personScore.score }}</span>
      </a-form-item>
    </a-form>
  </a-modal>
</template>

<script>
import verify from 'libs/verify'
import AFormItem from 'ant-design-vue/es/form/FormItem'
import {validateID} from "@/libs/validate";
import moment from "moment/moment";

export default {
  name: 'myScore',
  components: {
    AFormItem,
  },
  data() {
    return {
      verify,
      form: this.$form.createForm(this),
      showAddTable: false,
      input: false,
      selectScheduleId: "",
      classTId: "",
      personScore: {},
      realStartTime: "",
      scheduleSelectList: [],
    }
  },
  computed: {
    formStyle() {
      return this.$store.state.common.formStyle
    }
  },
  props: {},
  watch: {},
  methods: {
    validateID,
    /**
     * Function    : saveApply
     * Description : 打开弹框
     * Input       : none
     * Return      : none
     */
    showModal(opt) {
      this.showAddTable = true
      this.classTId = opt.classTId ? opt.classTId : ''
      this.getPersonScore()
    },
    getPersonScore() {
      let para = {classTId: this.classTId}
      this.$store.dispatch('getPersonScoreAct', para).then(response => {
        if (response.code === 0) {
          this.personScore = response.data
          this.$message.success(response.message)
        } else {
          this.$message.error(response.message)
        }
      })
    },
    /**
     * Function    : showEdit
     * Description : 编辑时显示
     * Input       : opt单个所有数据
     * Return      : none
     */
    showEdit(opt) {
      this.showAddTable = true
      this.selectScheduleId = opt.scheduleId
      this.id = opt.recordId
      this.realStartTime = moment(opt.realStartTime).format("YYYY-MM-DD HH:mm")
      this.$nextTick(() => {
        this.form.setFieldsValue(this.$pick({
          selectScheduleId: this.selectScheduleId,
          realStartTime: this.realStartTime
        }, ['selectScheduleId', 'realStartTime']))
      })
    },


    /**
     * Function    : cancelApply
     * Description : 取消弹出框
     * Input       : val
     * Return      : none
     */
    cancelApply() {
      this.showAddTable = false
      let _this = this
      _this.selectScheduleId = ''
      setTimeout(function () {
        _this.form.resetFields()
      }, 100)
    },

  },


  created() {
  }
}
</script>
